#pragma once
#ifndef LOGIC_SERVER_LOGIN_H
#define LOGIC_SERVER_LOGIN_H

#include "ProtoInc.h"
#include "DataBrickClient.h"

class LogicLoginManager
{
private:
	static LogicLoginManager * plogin;

	LogicLoginManager() {};

	enum
	{
		max_gate_id = 10,
		max_level = 30,
	};

	static const int score_gate[max_gate_id];   //关卡分数
	static const int level_score[max_level];   //等级与分数

public:
	static LogicLoginManager * GetInstance();

	//处理登录
	int Process(Base::LoginReq * req, Base::LoginResp * resp);

	//处理击中
	int Process(Base::HitBrickReq * req, Base::HitBrickResp * resp);

	//处理死亡
	int Process(Base::BallDeadReq * req, Base::BallDeadResp * resp);

private:
	int AddScore(DataBase & base, unsigned score);
	int GetLevel(unsigned score);
};

#endif  //LOGIC_SERVER_LOGIN_H
